FROM python:3.11-slim

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    git \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY chat_with_repo/ ./chat_with_repo/
COPY main.py .
COPY setup.py .

# Create necessary directories
RUN mkdir -p repos chroma_db

# Make main.py executable
RUN chmod +x main.py

# Set environment variables
ENV PYTHONPATH=/app

# Default command
CMD ["python", "main.py", "--help"]